<html>
  <head>
    <link rel="stylesheet" href="../../../../../node_modules/mocha/mocha.css" />
    <meta name="manual-polyfills" />
    <script>
      // Simulate no Shadow DOM.
      Object.defineProperty(Element.prototype, 'attachShadow', {
        value: undefined,
        configurable: true,
        enumerable: true,
        writable: true
      });

      window.ShadyDOM = {
        force: true,
        noPatch: true,
      };
      window.customElements = window.customElements || {};
      window.customElements.forcePolyfill = true;
    </script>
    <script src="../../../../../node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-pf_js.js"></script>
    <script src="../../../../../node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-pf_dom.js"></script>
    <script src="../../../../../node_modules/@webcomponents/template/template.js"></script>
    <script src="../../../../../node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-ce.js"></script>
    <script src="../../../../../node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-sd.js"></script>
  </head>

  <body>
    <script type="module">
      // node resolution doesn't seem to be working here.
      import {
        mocha,
        sessionFinished,
        sessionFailed,
      } from '../../../../../node_modules/@web/test-runner-mocha/dist/standalone.js';
      // import { mocha, sessionFinished, sessionFailed } from '@web/test-runner-mocha';

      (async () => {
        try {
          // setup mocha
          mocha.setup({ui: 'tdd', timeout: 60000});

          // Note, only test `noPatch` if it's explicitly enabled. This is set
          // on the `litHtmlPolyfillSupport` object for this purpose.
          await import('lit-html/polyfill-support.js');
          if (
            // Note, since this file is not built, it doesn't support DEV_MODE
            // so manually check both globals
            window['litHtmlPolyfillSupport']?.noPatchSupported ||
            window['litHtmlPolyfillSupportDevMode']?.noPatchSupported) {
            console.log('Testing `ShadyDOM.noPatch`');
            await import('./lit-html_html-test.js');
          }

          // run the tests, and notify the test runner after finishing
          mocha.run(() => {
            sessionFinished();
          });
        } catch (error) {
          console.error(error);
          // notify the test runner about errors
          sessionFailed(error);
        }
      })();
    </script>
    <div id="mocha"></div>
  </body>
</html>
